#include <stdio.h>
#include <string.h>
#include <assert.h>

void reverse(char *str)
{
    assert(str);
    int len = strlen(str);
    char *l = str;
    char *r = str + len - 1;
    while (l < r)
    {
        char tmp = *l;
        *l = *r;
        *r = tmp;
        l++;
        r--;
    }
}

int main()
{
    char arr[] = "ancdef";
    reverse(arr);
    printf("%s\n", arr);
    return 0;
}